package jp.peach_boys.sandbox.slim3.controller;

import java.util.List;

import jp.peach_boys.sandbox.slim3.domain.TabelogApi;
import jp.peach_boys.sandbox.slim3.domain.Todoufuken;
import jp.peach_boys.sandbox.slim3.dto.RestaurantInfo;

import org.slim3.controller.Controller;
import org.slim3.controller.Navigation;

public class IndexController extends Controller{

    private static final String ENCODING = "UTF-8";
    @Override
    protected Navigation run() throws Exception {
        Todoufuken todofuken = Todoufuken.get(asString("todofuken"));
        Integer page = asInteger("page");
        
        TabelogApi api = new TabelogApi("6ca78e7d6a4282636473e463034383810220662c");
        List<RestaurantInfo> restaurants = api.getRestaurantInfos(todofuken, page);
        requestScope("result", restaurants);

        int numOfRestaulant = api.getNumOfRestraunt(todofuken);
        requestScope("numOfResult", numOfRestaulant);

        return forward("index.jsp");
    }



    
}
